package com.ddwl.gate.controller;

import com.ddwl.gate.service.MobileRechargeRecordService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author hemiaojun
 * @Date 2020/9/24 20:10
 * 博寰回调
 */
@RequestMapping("/bohuan/callBack")
@RestController
public class BoHuanCallBackController {

    @Resource
    private MobileRechargeRecordService mobileRechargeRecordService;

    @PostMapping(value = "/notify")
    public String callBackNotify(@RequestParam("szAgentId") String szAgentId,@RequestParam("szOrderId") String szOrderId,@RequestParam("szPhoneNum") String szPhoneNum
            ,@RequestParam("nDemo") String nDemo,@RequestParam("nFlag") String nFlag,@RequestParam("fSalePrice") String fSalePrice,@RequestParam("szRtnMsg") String szRtnMsg,@RequestParam("szVerifyString") String szVerifyString) throws Exception{
        Map<String, String> map = new HashMap<>(16);
        map.put("szAgentId", szAgentId);
        map.put("szOrderId", szOrderId);
        map.put("szPhoneNum", szPhoneNum);
        map.put("fSalePrice", fSalePrice);
        map.put("nDemo", nDemo);
        map.put("nFlag", nFlag);
        map.put("szVerifyString", szVerifyString);
        return mobileRechargeRecordService.callBackNotify(map);
    }

    @PostMapping(value = "/receiveForward")
    String receiveForward(@RequestParam Map<String, String> map) throws Exception{
        return mobileRechargeRecordService.callBackNotify(map);
    }

}
